package com.icss.train_sys_back.service.train_manage.impl;

import com.icss.train_sys_back.entity.SeatEntity;
import com.icss.train_sys_back.entity.train_manage.TrainCarriageEntity;
import com.icss.train_sys_back.entity.train_manage.TrainEntity;
import com.icss.train_sys_back.mapper.train_manage.TrainCarriageManageMapper;
import com.icss.train_sys_back.service.train_manage.TrainCarriageManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author 小泽
 * @createTime 2025/9/25 16:35
 */
@Service
public class TrainCarriageManageServiceImpl implements TrainCarriageManageService {
    @Autowired
    private TrainCarriageManageMapper trainCarriageManageMapper;

    //车厢列表+分页+条件查询（如果有）
    @Override
    public List<TrainCarriageEntity> findListConditions(String trainNumber, String carriageNumber, Integer carriageType) {
        return trainCarriageManageMapper.findListConditions(trainNumber, carriageNumber, carriageType);
    }

    //车厢添加
    @Override
    public boolean add(TrainCarriageEntity trainCarriage) {
        return trainCarriageManageMapper.add(trainCarriage);
    }

    //加载车辆的车辆号
    @Override
    public List<TrainEntity> findTrainList() {
        return trainCarriageManageMapper.findTrainList();
    }

    //车厢更新
    @Override
    public boolean update(TrainCarriageEntity trainCarriage) {
        return trainCarriageManageMapper.update(trainCarriage);
    }

    //根据 id 删除车厢
    @Override
    public boolean delete(Integer id) {
        return trainCarriageManageMapper.delete(id);
    }

    //获取所有车厢 类型
    @Override
    public List<TrainCarriageEntity> getAllCarriageTypes() {
        return trainCarriageManageMapper.getAllCarriageTypes();
    }

    //添加座位
    @Override
    public void addSeats(List<SeatEntity> seatEntityList) {
        trainCarriageManageMapper.addSeats(seatEntityList);
    }

    //添加车厢
    @Override
    public void addCarriages(List<TrainCarriageEntity> carriageEntityList) {
        trainCarriageManageMapper.addCarriage(carriageEntityList);
    }
}
